﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Aker.DevTeam;
using Extensions;

namespace Aker.POrder
{
    public partial class ProductBasket : XForm
    {
        public ProductBasket()
        {
            InitializeComponent();
        }

        private void btnClear_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            AppSession.ProductBasket.Clear();
            DataTable dtBasket = Data.DB.Product.Clone();
            gv.Init(dtBasket);
        }

        private void btnRefresh_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            DataTable dtBasket = Data.DB.Product.Clone();
            foreach (int productId in AppSession.ProductBasket)
            {
                dtBasket.ImportRow(Data.DB.Product.FindByProductId(productId));
            }
            gv.Init(dtBasket);
            gv.MakeColumnInvisible("Price2Dollar", "Price2Euro", "Price3Dollar", "Price3Euro", "Photo", "ModifiedBy", "Select", "Order", "PrintCount", "Qty", "PriceEuro");
            gv.BestFitColumns();
        }
    }
}